var taskHandler = (function() {
    var chart = null;
    var timeX = [];
    var subtitle = {
        style:{
            color:"#000",
            fontWeight:"bold"
        }
    };
    var getTimeX=function(){
        timeX = [];
        var str='',k='';
        for(var i=0,m=0;m<24;i++){
            if(i==60){
                m++;
                i=00;
            }
            if(i%15==0){
              if(i==0){
                k='0';
              }else{
                k='';
              }
              if(m<10){
                str='0'+m+':'+i+k+':00';
              }else{
                str=m+':'+i+k+':00';
              }
               timeX.push(str);  
            }   
        }
        return timeX;
    };   

    var showHighChart1 = function(total, exectotal, dayTotal, dayExecTotal){
    	getTimeX();
        var clickDetected = false;
            chart = new Highcharts.Chart({
                chart: {
                    renderTo: 'container',
                    animation: false,
                    zoomType: "y"
                },
                
                title: {
                    text: '任务量('+dayTotal+'|'+dayExecTotal+')' //标题
                },
                credits: {
                    enabled: false
                },
                xAxis: {
                    categories: timeX //x轴
                },
                yAxis:{
                },
                plotOptions: {
                    column: {
                        stacking: 'normal',                
                        dataLabels: {
                            enabled: false
                        },
                    },
                    line: {
                        cursor: 'ns-resize'
                    }
                },
                series: [{
                	name:'总量',
                    data:total,
                    draggableY: false,
                    dragMinY: 0
                },{
                	name:'下发量',
                    data:exectotal,
                    draggableY: false,
                    dragMinY: 0
                }]
            });
    
    }
    
    /**
    ** 显示图标
    **/
    var showHighChart = function(total, exectotal){
    	getTimeX();
        var clickDetected = false;
            chart = new Highcharts.Chart({
                chart: {
                    renderTo: 'container',
                    animation: false,
                    zoomType: "y"
                },
                
                title: {
                    text: '任务量' //标题
                },
                credits: {
                    enabled: false
                },
                xAxis: {
                    categories: timeX //x轴
                },
                yAxis:{
                },
                plotOptions: {
                    column: {
                        stacking: 'normal',                
                        dataLabels: {
                            enabled: false
                        },
                    },
                    line: {
                        cursor: 'ns-resize'
                    }
                },
                series: [{
                	name:'总量',
                    data:total,
                    draggableY: false,
                    dragMinY: 0
                },{
                	name:'下发量',
                    data:exectotal,
                    draggableY: false,
                    dragMinY: 0
                }]
            });
    };  

    return {
        showHighChart: showHighChart,
        showHighChart1: showHighChart1,
        getTimeX:getTimeX
    };
}());